Integrand size = 31, antiderivative size = 129 \[ \int \frac {\sec (e+f x)}{(a+a \sec (e+f x))^2 (c+d \sec (e+f x))} \, dx=\frac {2 d^2 \text {arctanh}\left (\frac {\sqrt {c-d} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c+d}}\right )}{a^2 (c-d)^{5/2} \sqrt {c+d} f}+\frac {\tan (e+f x)}{3 (c-d) f (a+a \sec (e+f x))^2}+\frac {(c-4 d) \tan (e+f x)}{3 (c-d)^2 f \left (a^2+a^2 \sec (e+f x)\right )} \]
[Out]
Time = 0.28 (sec) , antiderivative size = 183, normalized size of antiderivative = 1.42, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.194, Rules used = {4072, 106, 157, 12, 95, 211} \[ \int \frac {\sec (e+f x)}{(a+a \sec (e+f x))^2 (c+d \sec (e+f x))} \, dx=\frac {(c-4 d) \tan (e+f x)}{3 f (c-d)^2 \left (a^2 \sec (e+f x)+a^2\right )}-\frac {2 d^2 \tan (e+f x) \arctan \left (\frac {\sqrt {c+d} \sqrt {a \sec (e+f x)+a}}{\sqrt {c-d} \sqrt {a-a \sec (e+f x)}}\right )}{a f (c-d)^{5/2} \sqrt {c+d} \sqrt {a-a \sec (e+f x)} \sqrt {a \sec (e+f x)+a}}+\frac {\tan (e+f x)}{3 f (c-d) (a \sec (e+f x)+a)^2} \]
[In]
[Out]
Rule 12
Rule 95
Rule 106
Rule 157
Rule 211
Rule 4072
Rubi steps \begin{align*} \text {integral}& = -\frac {\left (a^2 \tan (e+f x)\right ) \text {Subst}\left (\int \frac {1}{\sqrt {a-a x} (a+a x)^{5/2} (c+d x)} \, dx,x,\sec (e+f x)\right )}{f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}} \\ & = \frac {\tan (e+f x)}{3 (c-d) f (a+a \sec (e+f x))^2}+\frac {\tan (e+f x) \text {Subst}\left (\int \frac {-a^2 (c-3 d)-a^2 d x}{\sqrt {a-a x} (a+a x)^{3/2} (c+d x)} \, dx,x,\sec (e+f x)\right )}{3 a (c-d) f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}} \\ & = \frac {\tan (e+f x)}{3 (c-d) f (a+a \sec (e+f x))^2}+\frac {(c-4 d) \tan (e+f x)}{3 (c-d)^2 f \left (a^2+a^2 \sec (e+f x)\right )}-\frac {\tan (e+f x) \text {Subst}\left (\int \frac {3 a^4 d^2}{\sqrt {a-a x} \sqrt {a+a x} (c+d x)} \, dx,x,\sec (e+f x)\right )}{3 a^4 (c-d)^2 f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}} \\ & = \frac {\tan (e+f x)}{3 (c-d) f (a+a \sec (e+f x))^2}+\frac {(c-4 d) \tan (e+f x)}{3 (c-d)^2 f \left (a^2+a^2 \sec (e+f x)\right )}-\frac {\left (d^2 \tan (e+f x)\right ) \text {Subst}\left (\int \frac {1}{\sqrt {a-a x} \sqrt {a+a x} (c+d x)} \, dx,x,\sec (e+f x)\right )}{(c-d)^2 f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}} \\ & = \frac {\tan (e+f x)}{3 (c-d) f (a+a \sec (e+f x))^2}+\frac {(c-4 d) \tan (e+f x)}{3 (c-d)^2 f \left (a^2+a^2 \sec (e+f x)\right )}-\frac {\left (2 d^2 \tan (e+f x)\right ) \text {Subst}\left (\int \frac {1}{a c-a d-(-a c-a d) x^2} \, dx,x,\frac {\sqrt {a+a \sec (e+f x)}}{\sqrt {a-a \sec (e+f x)}}\right )}{(c-d)^2 f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}} \\ & = \frac {\tan (e+f x)}{3 (c-d) f (a+a \sec (e+f x))^2}-\frac {2 d^2 \arctan \left (\frac {\sqrt {c+d} \sqrt {a+a \sec (e+f x)}}{\sqrt {c-d} \sqrt {a-a \sec (e+f x)}}\right ) \tan (e+f x)}{a (c-d)^{5/2} \sqrt {c+d} f \sqrt {a-a \sec (e+f x)} \sqrt {a+a \sec (e+f x)}}+\frac {(c-4 d) \tan (e+f x)}{3 (c-d)^2 f \left (a^2+a^2 \sec (e+f x)\right )} \\ \end{align*}
Result contains complex when optimal does not.
Time = 2.05 (sec) , antiderivative size = 209, normalized size of antiderivative = 1.62 \[ \int \frac {\sec (e+f x)}{(a+a \sec (e+f x))^2 (c+d \sec (e+f x))} \, dx=\frac {\cos \left (\frac {1}{2} (e+f x)\right ) \left (-\frac {24 i d^2 \arctan \left (\frac {(i \cos (e)+\sin (e)) \left (c \sin (e)+(-d+c \cos (e)) \tan \left (\frac {f x}{2}\right )\right )}{\sqrt {c^2-d^2} \sqrt {(\cos (e)-i \sin (e))^2}}\right ) \cos ^3\left (\frac {1}{2} (e+f x)\right ) (\cos (e)-i \sin (e))}{\sqrt {c^2-d^2} \sqrt {(\cos (e)-i \sin (e))^2}}+\sec \left (\frac {e}{2}\right ) \left (3 (c-3 d) \sin \left (\frac {f x}{2}\right )-3 (c-2 d) \sin \left (e+\frac {f x}{2}\right )+(2 c-5 d) \sin \left (e+\frac {3 f x}{2}\right )\right )\right )}{3 a^2 (c-d)^2 f (1+\cos (e+f x))^2} \]
[In]
[Out]
Time = 0.66 (sec) , antiderivative size = 122, normalized size of antiderivative = 0.95
method | result | size |
derivativedivides | \(\frac {-\frac {\frac {c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}}{3}-\frac {d \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}}{3}-c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+3 d \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\left (c -d \right )^{2}}+\frac {4 d^{2} \operatorname {arctanh}\left (\frac {\left (c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{\left (c -d \right )^{2} \sqrt {\left (c +d \right ) \left (c -d \right )}}}{2 f \,a^{2}}\) | \(122\) |
default | \(\frac {-\frac {\frac {c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}}{3}-\frac {d \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}}{3}-c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+3 d \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\left (c -d \right )^{2}}+\frac {4 d^{2} \operatorname {arctanh}\left (\frac {\left (c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{\left (c -d \right )^{2} \sqrt {\left (c +d \right ) \left (c -d \right )}}}{2 f \,a^{2}}\) | \(122\) |
risch | \(\frac {2 i \left (3 \,{\mathrm e}^{2 i \left (f x +e \right )} c -6 d \,{\mathrm e}^{2 i \left (f x +e \right )}+3 \,{\mathrm e}^{i \left (f x +e \right )} c -9 d \,{\mathrm e}^{i \left (f x +e \right )}+2 c -5 d \right )}{3 f \,a^{2} \left (c -d \right )^{2} \left ({\mathrm e}^{i \left (f x +e \right )}+1\right )^{3}}+\frac {d^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c^{2}-i d^{2}+\sqrt {c^{2}-d^{2}}\, d}{\sqrt {c^{2}-d^{2}}\, c}\right )}{\sqrt {c^{2}-d^{2}}\, \left (c -d \right )^{2} f \,a^{2}}-\frac {d^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {i c^{2}-i d^{2}-\sqrt {c^{2}-d^{2}}\, d}{\sqrt {c^{2}-d^{2}}\, c}\right )}{\sqrt {c^{2}-d^{2}}\, \left (c -d \right )^{2} f \,a^{2}}\) | \(249\) |
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 270 vs. \(2 (116) = 232\).
Time = 0.29 (sec) , antiderivative size = 598, normalized size of antiderivative = 4.64 \[ \int \frac {\sec (e+f x)}{(a+a \sec (e+f x))^2 (c+d \sec (e+f x))} \, dx=\left [\frac {3 \, {\left (d^{2} \cos \left (f x + e\right )^{2} + 2 \, d^{2} \cos \left (f x + e\right ) + d^{2}\right )} \sqrt {c^{2} - d^{2}} \log \left (\frac {2 \, c d \cos \left (f x + e\right ) - {\left (c^{2} - 2 \, d^{2}\right )} \cos \left (f x + e\right )^{2} + 2 \, \sqrt {c^{2} - d^{2}} {\left (d \cos \left (f x + e\right ) + c\right )} \sin \left (f x + e\right ) + 2 \, c^{2} - d^{2}}{c^{2} \cos \left (f x + e\right )^{2} + 2 \, c d \cos \left (f x + e\right ) + d^{2}}\right ) + 2 \, {\left (c^{3} - 4 \, c^{2} d - c d^{2} + 4 \, d^{3} + {\left (2 \, c^{3} - 5 \, c^{2} d - 2 \, c d^{2} + 5 \, d^{3}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{6 \, {\left ({\left (a^{2} c^{4} - 2 \, a^{2} c^{3} d + 2 \, a^{2} c d^{3} - a^{2} d^{4}\right )} f \cos \left (f x + e\right )^{2} + 2 \, {\left (a^{2} c^{4} - 2 \, a^{2} c^{3} d + 2 \, a^{2} c d^{3} - a^{2} d^{4}\right )} f \cos \left (f x + e\right ) + {\left (a^{2} c^{4} - 2 \, a^{2} c^{3} d + 2 \, a^{2} c d^{3} - a^{2} d^{4}\right )} f\right )}}, \frac {3 \, {\left (d^{2} \cos \left (f x + e\right )^{2} + 2 \, d^{2} \cos \left (f x + e\right ) + d^{2}\right )} \sqrt {-c^{2} + d^{2}} \arctan \left (-\frac {\sqrt {-c^{2} + d^{2}} {\left (d \cos \left (f x + e\right ) + c\right )}}{{\left (c^{2} - d^{2}\right )} \sin \left (f x + e\right )}\right ) + {\left (c^{3} - 4 \, c^{2} d - c d^{2} + 4 \, d^{3} + {\left (2 \, c^{3} - 5 \, c^{2} d - 2 \, c d^{2} + 5 \, d^{3}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{3 \, {\left ({\left (a^{2} c^{4} - 2 \, a^{2} c^{3} d + 2 \, a^{2} c d^{3} - a^{2} d^{4}\right )} f \cos \left (f x + e\right )^{2} + 2 \, {\left (a^{2} c^{4} - 2 \, a^{2} c^{3} d + 2 \, a^{2} c d^{3} - a^{2} d^{4}\right )} f \cos \left (f x + e\right ) + {\left (a^{2} c^{4} - 2 \, a^{2} c^{3} d + 2 \, a^{2} c d^{3} - a^{2} d^{4}\right )} f\right )}}\right ] \]
[In]
[Out]
\[ \int \frac {\sec (e+f x)}{(a+a \sec (e+f x))^2 (c+d \sec (e+f x))} \, dx=\frac {\int \frac {\sec {\left (e + f x \right )}}{c \sec ^{2}{\left (e + f x \right )} + 2 c \sec {\left (e + f x \right )} + c + d \sec ^{3}{\left (e + f x \right )} + 2 d \sec ^{2}{\left (e + f x \right )} + d \sec {\left (e + f x \right )}}\, dx}{a^{2}} \]
[In]
[Out]
Exception generated. \[ \int \frac {\sec (e+f x)}{(a+a \sec (e+f x))^2 (c+d \sec (e+f x))} \, dx=\text {Exception raised: ValueError} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 249 vs. \(2 (116) = 232\).
Time = 0.33 (sec) , antiderivative size = 249, normalized size of antiderivative = 1.93 \[ \int \frac {\sec (e+f x)}{(a+a \sec (e+f x))^2 (c+d \sec (e+f x))} \, dx=-\frac {\frac {12 \, {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, c - 2 \, d\right ) + \arctan \left (\frac {c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{\sqrt {-c^{2} + d^{2}}}\right )\right )} d^{2}}{{\left (a^{2} c^{2} - 2 \, a^{2} c d + a^{2} d^{2}\right )} \sqrt {-c^{2} + d^{2}}} + \frac {a^{4} c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 2 \, a^{4} c d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} + a^{4} d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 3 \, a^{4} c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 12 \, a^{4} c d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 9 \, a^{4} d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{a^{6} c^{3} - 3 \, a^{6} c^{2} d + 3 \, a^{6} c d^{2} - a^{6} d^{3}}}{6 \, f} \]
[In]
[Out]
Time = 13.88 (sec) , antiderivative size = 168, normalized size of antiderivative = 1.30 \[ \int \frac {\sec (e+f x)}{(a+a \sec (e+f x))^2 (c+d \sec (e+f x))} \, dx=\frac {\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\left (\frac {1}{a^2\,\left (c-d\right )}-\frac {c+d}{2\,a^2\,{\left (c-d\right )}^2}\right )}{f}-\frac {{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^3}{6\,a^2\,f\,\left (c-d\right )}-\frac {d^2\,\mathrm {atan}\left (\frac {1{}\mathrm {i}\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\,c^3-3{}\mathrm {i}\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\,c^2\,d+3{}\mathrm {i}\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\,c\,d^2-1{}\mathrm {i}\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\,d^3}{\sqrt {c+d}\,{\left (c-d\right )}^{5/2}}\right )\,2{}\mathrm {i}}{a^2\,f\,\sqrt {c+d}\,{\left (c-d\right )}^{5/2}} \]
[In]
[Out]